package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.hiultra.archive.domain.ArchiveBoxInoutdetail;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveBoxIllegalDetailRecords;
import com.hiultra.archive.service.IArchiveBoxIllegalDetailRecordsService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 非法携带详情Controller
 *
 * @author 派大星
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/archive/ArchiveBoxIllegalDetailRecords")
public class ArchiveBoxIllegalDetailRecordsController extends BaseController
{
    @Autowired
    private IArchiveBoxIllegalDetailRecordsService archiveBoxIllegalDetailRecordsService;

    /**
     * 查询非法携带详情列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveBoxIllegalDetailRecords archiveBoxIllegalDetailRecords)
    {
        startPage();
        List<ArchiveBoxIllegalDetailRecords> list = archiveBoxIllegalDetailRecordsService.selectArchiveBoxIllegalDetailRecordsList(archiveBoxIllegalDetailRecords);
        return getDataTable(list);
    }

    /**
     * 导出非法携带详情列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:export')")
    @Log(title = "非法携带详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveBoxIllegalDetailRecords archiveBoxIllegalDetailRecords)
    {
        List<ArchiveBoxIllegalDetailRecords> list = archiveBoxIllegalDetailRecordsService.selectArchiveBoxIllegalDetailRecordsList(archiveBoxIllegalDetailRecords);
        ExcelUtil<ArchiveBoxIllegalDetailRecords> util = new ExcelUtil<ArchiveBoxIllegalDetailRecords>(ArchiveBoxIllegalDetailRecords.class);
        util.exportExcel(response, list, "非法携带详情数据");
    }

    /**
     * 获取非法携带详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(archiveBoxIllegalDetailRecordsService.selectArchiveBoxIllegalDetailRecordsById(id));
    }

    /**
     * 新增非法携带详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:add')")
    @Log(title = "非法携带详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveBoxIllegalDetailRecords archiveBoxIllegalDetailRecords)
    {
        return toAjax(archiveBoxIllegalDetailRecordsService.insertArchiveBoxIllegalDetailRecords(archiveBoxIllegalDetailRecords));
    }

    /**
     * 修改非法携带详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:edit')")
    @Log(title = "非法携带详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveBoxIllegalDetailRecords archiveBoxIllegalDetailRecords)
    {
        return toAjax(archiveBoxIllegalDetailRecordsService.updateArchiveBoxIllegalDetailRecords(archiveBoxIllegalDetailRecords));
    }

    /**
     * 删除非法携带详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:remove')")
    @Log(title = "非法携带详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(archiveBoxIllegalDetailRecordsService.deleteArchiveBoxIllegalDetailRecordsByIds(ids));
    }
    /**
     * 获取非法携带档案盒详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxIllegalDetailRecords:query')")
    @GetMapping(value = "/selectArchiveBoxillegalByRecordId/{recordId}")
    public AjaxResult selectArchiveBoxillegalByRecordId(@PathVariable("recordId") String recordId)
    {
        List<ArchiveBoxIllegalDetailRecords> data = archiveBoxIllegalDetailRecordsService.selectArchiveBoxillegalByRecordId(recordId);
        return AjaxResult.success(data);
    }
}
